<template>
  <div>
     <el-dialog
    :model-value="visible"
    title="企业资金信息"
    width="800"
    :close-on-click-modal="false"
    @close="cls"
  >
  <div>当前企业余额：<el-input class="ipt" :disabled="true" v-model="mon"></el-input></div>
   <el-table :data="tableData" stripe style="width: 100%">
    <el-table-column prop="createTime" label="账户变动时间" width="150" />
    <el-table-column prop="reason" label="账户变动原因"  width="180"/>
    <el-table-column prop="avaliableMoney" label="可用资金账户" width="120" />
    <el-table-column prop="freezeMoney" label="冻结资金账户" width="120" />
    <el-table-column prop="type" label="变动类型" width="120"/>
  </el-table>
      <div class="footer">
        <el-button type="primary" >保存</el-button>
        <el-button  @click="cls">
          不保存关闭
        </el-button>
      </div>
  </el-dialog>
  </div>
</template>
<script setup>
import {ref,onMounted} from 'vue'
import { moneyEnterprise } from '@/api/platform/enterprise.js';
//属性传参
const props=defineProps({
  visible:{
    type:Boolean,
    default:false
  },
  id:{
    type:Number,
    default:0
  }
})

//资金列表
const tableData = ref([])

//定义事件
const emits=defineEmits(["close"])
function cls(){
  emits("close");
}

let mon=ref('')

//初始函数
async  function init(id){//父组件将id传递过来
  //根据id查询
  let res= await moneyEnterprise(id);
  if(res.code==200){
    tableData.value=res.data.detailList;
    mon.value=res.data.money
  }
}

//暴露
defineExpose({init})
</script>
<style scoped>
.ipt {
  width: 300px;
  margin-left: 10px;
}
.footer{
  line-height:40px;
  text-align:center
}
</style>
